home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
oper_sys
/
emerald
/
emrldsys.lha
/
Language
/
Compiler
/
genutils.h
< prev
next >
Wrap
C/C++ Source or Header
|
1990-08-16
|
5KB
|
153 lines
/*
* @(#)genutils.h 1.4 9/24/87
*/
#ifndef genutils_h
#define genutils_h
#ifndef FILE
#include "assert.h"
#endif
#ifndef nodes_h
#include "nodes.h"
#endif
#ifndef datadesc_h
#include "datadesc.h"
#endif
#ifndef flags_h
#include "flags.h"
#endif
extern int nextLabelNumber, currentInstruction,
nextObjectNumber, nextOperationNumber;
extern OID currentCodeOID;
extern FILE *codeFile;
extern NodePtr currentObject;
extern int operationTempSize, operationMaxStack;
extern void saveRelocationInfo(), writeDD(), generateKernelCall(),
displayDD(), lineNumberComment(),
writeData(), writeHex(), writeWord(), initializeRelocationInfo(),
dumpRelocationInfo(), initializeTemplates(), initializeTemplate(),
saveShortDynamicTemplate(), saveShortStaticTemplate(),
saveRegisterTemplate(), dumpTemplate(), dumpTemplates(),
ensureGenerate(), generate(), forceLineNumber(),
generateEnterOperation(), generateReturn(), generateCallC(),
writeHexComment(), generateBranch();
extern char *addressToString();
extern ODTag BuildTag();
extern int findATOpNumber(), translateATOpNumberToCTOpNumber();
extern NodePtr resolveOIDToCTOrAT(), resolveToCTOrAT(),
getBestInfoFromExpression(), getBestInfoFromAbCon();
extern OID getCodeID(), getID();
extern DD buildAbCon(), buildAbConFromObject(), buildConCon(),
increaseIndirection(), buildRegisterDD(), buildAddressDD(),
buildManifestDD(), buildRegisterDDNC(), buildLabelDD();
extern DD nullDD, pusher, popper, nilDD;
extern NodePtr nilNode;
extern void freeDD();
#define FREEDD(d) { freeDD(d); (d) = nullDD; }
#define FREEV(v) { FREEDD((v)->data) ; FREEDD((v)->abCon); }
#define DISCARDDD(D) (D) = nullDD
#define DISCARDV(v) {DISCARDDD((v)->data); DISCARDDD((v)->abCon); }
extern NodePtr getConcreteTypeFromAbCon(), ATCTOIDToCTPtr();
extern int getElementTypeSize(), getSymbolSize();
extern Symbol getElementTypeSymbol();
extern Brand abConToBrand();
extern Boolean isPop();
#define writeTag(t) (writeHex(*(unsigned *) &(t)))
#define ISMANIFEST(st) (! isARealImport(st))
typedef struct sIPMapCEntry {
int codeLabel;
int dataLabel;
int value;
} IPMapCEntry, *IPMapCEntryPtr;
typedef struct sIPMapCollector {
int maxSize;
int nextToFill;
int lowCodeLabel;
IPMapCEntry entry[1];
} IPMapCollector, *IPMapCollectorPtr;
extern IPMapCollectorPtr lineNumberMap, unavailableHandlerMap, failureHandlerMap;
extern Boolean mapHasEntries();
extern IPMapCollectorPtr createIPMap();
extern void addToIPMap(), dumpIPMap();
extern void initializeMaps(), finalizeMaps(), dumpMaps();
extern void blockStart(), blockEnd();
extern Boolean wroteCode, DDNeedsLabel();
extern void HSPush(), HSDump();
extern DD preemptAndAssign(), generateCompare();
extern void emitBranchOnBit(), writeLabel();
typedef struct sLoopRecord {
int label;
struct sLoopRecord *enclosing;
} LoopRecord, *LoopRecordPtr;
extern LoopRecordPtr loops;
#define inRange(A,B,C) ((A) >= (B) && (A) <= (C))
extern char *registerName[];
#define RN(A) registerName[(int)(A)]
#ifdef vax
# define ALIGNDIRECTIVE "\t.align\t2\n"
# define IMMEDIATECHAR '$'
# define GLOBALVARINDICATOR "*$"
# define COMMENTCHAR '#'
# define SETLASTJUMPFROM "\tmoval\t8f,*$_lastJumpFrom\n8:\n"
# define FLOATJUMPCHAR ""
# define POPABCON "\taddl2\t$4,sp\n"
#endif
#ifdef sun
# define ALIGNDIRECTIVE ""
# define IMMEDIATECHAR '#'
# define GLOBALVARINDICATOR ""
# define COMMENTCHAR '|'
# define SETLASTJUMPFROM "\tpea\tpc@(8f-.-2:l)\n\tmovl\tsp@+,_lastJumpFrom\n8:\n"
# define FLOATJUMPCHAR "f"
# define POPABCON "\taddqw\t#4,sp\n"
#endif
void jumpDebug(), jumpCheck(), initializeJumpDebug(), finalizeJumpDebug();
#define JUMPDEBUG() if (gdflag) jumpDebug();
#define JUMPCHECK() if (gdflag) jumpCheck();
#define INITIALIZEJUMPDEBUG() if (gdflag) initializeJumpDebug();
#define FINALIZEJUMPDEBUG() if (gdflag) finalizeJumpDebug();
#ifdef vax
#define INC(X) if (gmflag && doGenerateCode) {\
X ++; \
emit("\tincl\t*$ _%s\n", "X"); \
}
#endif
#ifdef sun
#define INC(X) if (gmflag && doGenerateCode) {\
X ++; \
emit("\taddql\t#1,_%s\n", "X"); \
}
#endif
#ifdef vax
#define INCC(X) if (gmflag && doGenerateCode) {\
X ++; \
emit("\tmovpsl\t-(sp)\n"); \
emit("\tcvtlw\t(sp)+,-(sp)\n"); \
emit("\tbicw2\t$0xfff0,(sp)\n"); \
emit("\tincl\t*$ _%s\n", "X"); \
emit("\tbicpsw\t$0xf\n"); \
emit("\tbispsw\t(sp)+\n"); \
}
#endif
#ifdef sun
#define INCC(X) if (gmflag && doGenerateCode) {\
X ++; \
emit("\tmovw\tcc,sp@-\n"); \
emit("\taddql\t#1,_%s\n", "X"); \
emit("\tmovw\tsp@+,cc\n"); \
}
#endif
#endif